package site.wtfu.framework.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import site.wtfu.framework.service.CustOuterService;
import site.wtfu.framework.service.IUserService;

import javax.annotation.Resource;
import java.util.ArrayList;

/**
 * Copyright 2021 wtfu.site Inc. All Rights Reserved.
 *
 * @author: 12302
 * @date: 2021-05-02
 */
@RestController
public class TestConsumerController {

    /* _12302_2021/5/2_< discard > */
    //@Autowired
    //public RestTemplate restTemplate;


    @Autowired
    public IUserService iUserService;

    @RequestMapping(value = "test")
    public Object test(){
        //return restTemplate.getForObject("http://spring-application-feign-name/getUserInfo/" + 10, ArrayList.class);
        return iUserService.getUsers(1);
    }


    @GetMapping("/test1")
    public Object getUserInfo2(){
        return iUserService.getUserId(1);
    }


    @Resource
    public CustOuterService custOuterService;

    @RequestMapping(value = "/API/UserOuter/getBasicCustInfoById", method = RequestMethod.POST,produces = {MediaType.APPLICATION_JSON_UTF8_VALUE})
    public Object testProvide(@RequestParam(value = "custId") Integer custId){
        return custOuterService.getBasicCustInfoById(1);
    }
}
